package nero.yncc.com.createart.base;

import android.app.Application;
import android.graphics.Typeface;
import android.telephony.TelephonyManager;
import android.view.Gravity;
import android.widget.Toast;


import org.xutils.x;

import java.io.File;

import cn.finalteam.galleryfinal.CoreConfig;
import cn.finalteam.galleryfinal.FunctionConfig;
import cn.finalteam.galleryfinal.GalleryFinal;
import cn.finalteam.galleryfinal.ImageLoader;
import cn.finalteam.galleryfinal.ThemeConfig;
import nero.yncc.com.createart.R;
import nero.yncc.com.createart.utils.ImageLoadlerForChoose;

/**
 * Created by nero on 17-6-19.
 */

public class BaseApplication extends Application {


    public static BaseApplication mContext;
    private Typeface iconTypeFace;
    private String compressDir;
    public static  int time=0;//注册60秒


    @Override
    public void onCreate() {
        super.onCreate();
        mContext = this;
        compressDir = getCacheDir().getAbsolutePath() + "/createart";
        File dir = new File(compressDir);
        if (!dir.exists()) {
            dir.mkdirs();
        }
        iconTypeFace = Typeface.createFromAsset(getAssets(), "fonts/iconfont.ttf");

        x.Ext.init(this);

        ThemeConfig theme = new ThemeConfig.Builder().setTitleBarBgColor(R.color.lineColorGray3)
                .build();
//配置功能
        FunctionConfig functionConfig = new FunctionConfig.Builder()
                .setEnableCamera(true)
                .setEnableEdit(true)
                .setEnableCrop(true)
                .setEnableRotate(true)
                .setCropSquare(true)
                .setEnablePreview(true)
                .build();
//配置imageloader
        ImageLoader imageloader = new ImageLoadlerForChoose();
        CoreConfig coreConfig = new CoreConfig.Builder(mContext, imageloader, theme)
                .setFunctionConfig(functionConfig)
                .build();
        GalleryFinal.init(coreConfig);

    }


    public static BaseApplication getInstance() {
        return mContext;
    }

    public Typeface getIconTypeFace() {
        return iconTypeFace;
    }


    public String getCompressDir() {
        return compressDir;
    }

}
